﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using CustomsSystem.BLL;
using CustomsSystem.Model;
using System.Collections.Generic;
namespace WEB.score
{
    public partial class scoreHandle : System.Web.UI.Page
    {
        ScoreManage scoreManage = new ScoreManage();
        CustomsSystem.Model.Score myScore = new Score();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.QueryString["ID"] != null)   //评价
                {
                    int id = Convert.ToInt32(Request.QueryString["ID"]);
                    myScore = scoreManage.GetModel(id);
                    sheetID.Text = myScore.sheetID.ToString();
                    suggest.Value = myScore.suggest;
                }
                else
                {
                    Response.Write("<script>alert('没有需要处理的评论')</script>");
                }
                if (myScore.handle != null)
                {
                    Response.Write("<script>alert('己处理!')</script>");
                    Response.Write("<script>window.document.location.href='scoreView.aspx'</script>");
                }
            }
        }

        protected void Submit_Click(object sender, EventArgs e)
        {
            ScoreManage manage = new ScoreManage();
            CustomsSystem.Model.Score myScore = new CustomsSystem.Model.Score();
            myScore.sheetID = Convert.ToInt32(sheetID.Text);
            myScore.handle = TextArea1.Value;
            if (manage.Exists(myScore.sheetID,myScore.handle) == false)
            {
                manage.Revise(myScore);
                Response.Write("<script>alert('己提交!')</script>");
                Response.Write("<script>window.document.location.href='/score/scoreView.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('己评价!')</script>");
                Response.Write("<script>window.document.location.href='/score/scoreView.aspx'</script>");
            }
        }
    }
}